#!/bin/sh

###
# Correo build script
# @author Nick Kreeger <nick@nkreeger.com>
#
# This script simply unzips the associated Mozilla tarball, stages it, and
# then builds Correo from the command line. This script only really needs
# to be build one time.
#
# Usage:
# 1.) For debug builds:
#       $ buildcorreo.sh debug
#
# 2.) For relese builds:
#       $ buildcorreo.sh release
#
# TODO: Add support for universal builds!
#
##


if [ $# != 1 ]; then
  echo "  usage: buildcorreo.sh [build-type]"
  echo "    where build-type options are:"
  echo "     - release" 
  echo "     - debug" 
  echo "     - clean"
  exit 1
fi

# TODO: Check for the available build options!!!

if [ $1 == "clean" ]; then
  `rm -R dist`
  exit 0
fi


# The build type, i.e. |relese| or |debug|:
build_type=$1

# The architecture type:
arch=`arch`

# Finally, the tarball:
tar_file="mozilla_18_"$build_type"_$arch.tgz"

# Tell the user we are about to build:
echo ""
echo "Setting up Correo build enviroment"
echo "=================================="
echo " - Build Type:   $build_type"
echo " - Architecture: $arch"
echo ""

# Stage the Tarball
echo "Staging Mozilla Framework..."

`tar -zxf moz/$tar_file`

